<script setup lang="ts">
import { useComponentCommon } from '@/hooks/useComponentCommon'
import { textComponentProps, transformToComponentProps, textStylePropNames } from '@/utils/defaultProps'
import { watchEffect } from 'vue'
defineOptions({
  name: 'LText'
})
const props = defineProps({
  tag: {
    type: String,
    default: 'div'
  },
  ...transformToComponentProps(textComponentProps),
})
let styleProps = {}
watchEffect(() => {
  const obj = useComponentCommon(props, textStylePropNames)
  styleProps = obj.styleProps
})



</script>

<template>
  <component :is="tag" :style="styleProps" class="l-text-component">{{ text }}</component>
</template>

<style scoped>
.l-text-component {
  white-space: pre-wrap;
  word-break: break-all;
  box-sizing: border-box;
  margin: 0;
  cursor: pointer;
} 
</style> 